//平台工具类
const platformUtil = {
    is_wx() {
        // #ifdef H5
        let en = window.navigator.userAgent.toLowerCase()
        // 匹配en中是否含有MicroMessenger字符串
        if (en.match(/MicroMessenger/i) == "micromessenger") {
            return true
        }
        // #endif
        return false
    },

    is_zfb() {
        // 判断是否为支付宝浏览器
        // #ifdef H5
        const ua = window.navigator.userAgent
        if (ua.match(/Alipay/i)) {
            return true
        }
        // #endif
        return false
    },
    getUserAgent() {
        let result = ""
        // #ifdef H5
        result = navigator.userAgent
        // #endif
        return result
    },
    getBrowser() {
        let result = ""
        return result
    },
    isMobile() {
        return true
    },
    getPlatform() {
        let system = uni.getSystemInfoSync()
        return system.platform
    },
}

module.exports = {
    is_wx: platformUtil.is_wx,
    is_zfb: platformUtil.is_zfb,
    getUserAgent: platformUtil.getUserAgent,
    getBrowser: platformUtil.getBrowser,
    isMobile: platformUtil.isMobile,
    getPlatform: platformUtil.getPlatform,
}
